<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"
	import="java.io.IOException,java.net.URL,sample.appsforyourdomain.AppsForYourDomainClient,com.google.gdata.client.appsforyourdomain.AppsForYourDomainService,com.google.gdata.client.appsforyourdomain.AppsForYourDomainQuery,com.google.gdata.client.appsforyourdomain.UserService,com.google.gdata.data.appsforyourdomain.provisioning.UserEntry,com.google.gdata.data.appsforyourdomain.provisioning.UserFeed,java.text.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> 
<META HTTP-EQUIV="Expires" CONTENT="-1">
<title>Choose one or more names...</title>
<script language="JavaScript" type="text/javascript">
<!-- 
function changeNab(newPath, keepValues, killAll){
	var curLoc = window.location.href;
	var newLoc = "";
	var pathLoc = curLoc.indexOf("&db=");
	if (pathLoc > -1){
		newLoc = curLoc.substring(0, pathLoc);
		pathLoc = curLoc.indexOf("&", pathLoc + 1);
		if (pathLoc == -1){
			newLoc = newLoc + "&db=" + newPath;
		} else {
			newLoc = newLoc + curLoc.substring(pathLoc) + "&db=" + newPath;
		}
	} else {
		newLoc = curLoc + "&db=" + newPath;
	}
	if (killAll){
		removeAll();
		storeValue(false);
	} else if (keepValues){
		storeValue(false);
	}
	window.location=newLoc;
}

function checkForBackspace(curVal, key){
	if (key == "8"){
		setTimeout("doSearch();", 100);
	}
}

function doKeyPress(curVal, key) {
	if(key =="13") {
		/* var trName = document.getElementById("nameChoicesTable").getElementsByTagName("tr")[0];
		if (trName.name){
			uName = trName.name;
		} else {
			uName = trName.className.substring(trName.className.indexOf(" ") + 1);
		}
		addValue(uName);
		document.getElementById("search").value = ""; */
		return false;
	} else {
		setTimeout("doSearch();", 100);
	}
}

function loadFirstPage() {
	try {
		// initialize variables
		var urlArray = document.location.href.split("/");
		URLPrefix = urlArray[0] + "//" + urlArray[2];

		// check to see if any parameters are being overridden from QueryString
		if (getURLParam("db") != "")
			dbPath = getURLParam("db");
		if (getURLParam("view") != ""){
			view = getURLParam("view");
		} else {
			view = "($VIMPeopleByLastName)"
		}
		if (getURLParam("columns") != ""){
			columns = getURLParam("columns").split(",");
		} else {
			columns = "0,2,3,5";
			columns = columns.split(",");
		}
		if (getURLParam("count") != ""){
			count = parseInt(getURLParam("count"), 10);
		} else {
			count = "16";
		}
		if (getURLParam("returnfield"))
			returnFieldName = getURLParam("returnfield");
		if (getURLParam("returncol") != "") {
			returnColumn = parseInt(getURLParam("returncol"), 10);
		} else {
			returnColumn = "1";
		}
		// get initial data set
		//var xmlDoc = doXMLHTTPGet(URLPrefix + "/" + dbPath + "/" + view + "?readviewentries&count=" + count, true);
	}
	catch (e) {
		document.getElementById("namelist").innerHTML = errormessage + e. message + " (" + e.name + ")";
	}
}

function nextPage() {
	try {
		// work out where the next page starts
		var lastMax = parseInt(results[results.length - 1].attributes[0].value, 10);
		var start = lastMax + 1;
		if (start > (viewTotalDocs - (count - 1))){
			start = viewTotalDocs - (count - 1);
		}
		// get the next page
		var xmlDoc = doXMLHTTPGet(URLPrefix + "/" + dbPath + "/" + view + "?readviewentries&start=" + start + "&count=" + count);
	}
	catch (e) {
		document.getElementById("namelist").innerHTML = errormessage + e. message + " (" + e.name + ")";
	}
}

function previousPage() {
	try {
		// work out where the previous page starts
		var lastMin = parseInt(results[0].attributes[0].value, 10);
		var start = lastMin - count;
		if (start < 1) {
			start = 1;
		}
		// get the previous page
		var xmlDoc = doXMLHTTPGet(URLPrefix + "/" + dbPath + "/" + view + "?readviewentries&start=" + start + "&count=" + count);
	}
	catch (e) {
		document.getElementById("namelist").innerHTML = errormessage + e. message + " (" + e.name + ")";
	}
}

function lastPage() {
	try {
		// work out where the last page starts
		start = viewTotalDocs - (count - 1);

		// get the next page
		var xmlDoc = doXMLHTTPGet(URLPrefix + "/" + dbPath + "/" + view + "?readviewentries&start=" + start + "&count=" + count);
	}
	catch (e) {
		document.getElementById("namelist").innerHTML = errormessage + e. message + " (" + e.name + ")";
	}
}

function doSearch() {
	try 	{	
		storeValue(false);
		var returnfield = getURLParam("returnfield");
		//alert(returnfield);
		var pageNum = getURLParam("pageNum");
		//alert(pageNum);
		var search = document.getElementById("search").value;
		//alert(search);
		if (search != "") {
			//var xmlDoc = doXMLHTTPGet(URLPrefix + "/" + dbPath + "/" + view + "?readviewentries&startkey=" + escape(search) + "&count=" + count);
			parent.location='/utils/contact_p_multi.jsp?returnfield=' + returnfield + '&pageNum=' + pageNum + '&search=' + search;
		} else {
			//var xmlDoc = doXMLHTTPGet(URLPrefix + "/" + dbPath + "/" + view + "?readviewentries&startkey=a&count=" + count);
		}
	}
	catch (e) {
		document.getElementById("namelist").innerHTML = errormessage + e. message + " (" + e.name + ")";
	}
}

function addValue(strValue) {
	var bAdd = true;
	for (i=0; i<aValues.length; i++) {
		if (aValues[i] == strValue) {
			bAdd = false;
			break;
		}
	}
	if (bAdd) {
		aValues[aValues.length] = strValue;
		displayCurrentValues();
		namesPicked = true;
	} else {
		window.status = ("The entry " + unescape(strValue) + " has already been added.");
	}
}

function removeValue(iIndex) {
	if (iIndex < aValues.length) {
		var aNewValues = new Array();
		for (iValue=0; iValue<aValues.length; iValue++) {
			if (iValue != iIndex) {
				aNewValues[aNewValues.length] = aValues[iValue];
			}
		}
		aValues = aNewValues;
		displayCurrentValues();
	}
}

function removeAll() {
	aValues = new Array();
	displayCurrentValues();
}

function storeValue(closeWindow) {
	try {
		var fieldReturn = window.opener.document.getElementById(returnFieldName);
		if (fieldReturn == null){
			fieldReturn = eval("window.opener.document.forms[0]." + returnFieldName);
		}
		if (fieldReturn) {
			if (fieldReturn.type == "text" || fieldReturn.type == "hidden" || fieldReturn.type == "textarea") {
				//fieldReturn.value = unescape(aValues.join("; "));     // This did not work correctly with FireFox - not sure why... Newbs 

				var retValue = ""
				for (var idx=0; idx<aValues.length; idx++) {
					retValue += (idx > 0) ? "; " : ""

					var wArray = unescape(aValues[idx]).split("\n")
					retValue += (wArray.length == 1) ? wArray[0] : wArray[1];
				}
				fieldReturn.value = retValue
			} else {
				fieldReturn.length = aValues.length;
				for (var i=0; i<aValues.length; i++) {
					var wArray = unescape(aValues[i]).split("\n")
					//var strReturn = unescape(aValues[i]);
					var strReturn = (wArray.length == 1) ? wArray[0] : wArray[1];
					fieldReturn.options[i].text = strReturn;
					fieldReturn.options[i].value = strReturn;
					fieldReturn.options[i].selected = true;
				}
			}
		} else {
			throw("Could not get field \"" + returnFieldName + "\"");
		}
	}
	catch (e) {
		alert("There has been an error returning the selected values:\n\n" + e.message);
	}
	if (closeWindow){
		window.close();
	}
}

function loadStartData() {
	try 	{
		var fieldReturn = window.opener.document.getElementById(returnFieldName);
		if (fieldReturn == null){
			fieldReturn = eval("window.opener.document.forms[0]." + returnFieldName);
		}
		if (fieldReturn) {
			if ((fieldReturn.type == "text" || fieldReturn.type == "hidden" || fieldReturn.type == "textarea") && fieldReturn.value != "") {
				aValues = fieldReturn.value.split("; ");
			} else {
				for (var i=0; i<fieldReturn.length; i++) {
					aValues[aValues.length] = escape(fieldReturn.options[i].text);
				}
			}
			displayCurrentValues();
		} else {
			throw("Could not get field \"" + returnFieldName + "\"");
		}
	}
	catch (e) {
		alert("There has been an error loading the start data:\n\n" + e.message);
	}
}

function displayCurrentValues() {
	aValues.sort();
	var storedlist = document.getElementById("storedlist");
	var strHTML = "<table width=\"100%\">";
	if (aValues.length > 0) {
		for (var iValue=0; iValue<aValues.length; iValue++) {
			strHTML += "<tr class=\"normal\" onMouseOver=\"this.className='highlight'\" onMouseOut=\"this.className='normal'\" onClick=\"removeValue(" + iValue + ");\">";
			strHTML += "<td>" + unescape(aValues[iValue]) + "</td>";
			strHTML += "</tr>"
		}
	} else {
		strHTML += "<tr class=\"normal\" onMouseOver=\"this.className='highlight'\" onMouseOut=\"this.className='normal'\">";
		strHTML += "<td>Click any name to add it to this list</td></tr>";
	}
	strHTML += "</table>";
	storedlist.innerHTML = strHTML;
}

function displayData(xmlDoc) {
	// get areas which we are going to write results into
	var namelist = document.getElementById("namelist");
	var countlist = document.getElementById("countlist");

	try {
		namelist.innerHTML = "Please Wait...";

		//Open the XML Document
		var root = xmlDoc.documentElement;
		results = root.getElementsByTagName("viewentry");

		//Get the toplevelentries value each time in case it changes
		viewTotalDocs = parseInt(root.attributes[0].value, 10);

		var strHTML = "<table width=\"100%\" id=\"nameChoicesTable\">";
		for (i=0; i<results.length; i++) {
			//Get the value which the row will return if clicked
			var returnText = getInnerText(results[i].getElementsByTagName("entrydata")[returnColumn]);

			//Write the tr tag
			if (i % 2 == 0){
				strHTML += "<tr class=\"normal1 " + escape(returnText) + "\" onMouseOver=\"this.className='highlight'\" onMouseOut=\"this.className='normal1'\" name=" + escape(returnText) + " onClick=\"addValue('" + escape(returnText) + "');\">";
			} else {
				strHTML += "<tr class=\"normal2 " + escape(returnText) + "\" onMouseOver=\"this.className='highlight'\" onMouseOut=\"this.className='normal2'\" name=" + escape(returnText) + " onClick=\"addValue('" + escape(returnText) + "');\">";
			}
			for (iCol=0; iCol < columns.length; iCol++) {
				//Write each cell of the current row
				var text;
				try {
					text = getInnerText(results[i].getElementsByTagName("entrydata")[parseInt(columns[iCol], 10)]);
				}
				catch (e) {
					text =+ e. message + " (" + e.name + ")";
				}
				strHTML += "<td>" + text + "</td>";
			}
			strHTML += "</tr>";
		}
		strHTML += "</table>";

		//Output the document count details
		countlist.innerHTML = results[0].attributes[0].value + " to " + results[results.length - 1].attributes[0].value + " of " + viewTotalDocs + " records";

		//Output the table HTML
		namelist.innerHTML = strHTML;
	}
	catch (e) {
		namelist.innerHTML = errormessage + e. message + " (" + e.name + ")";
	}
}

function doXMLHTTPGet(vurl) {
	var returnData = null;

	if (window.XMLHttpRequest) {
		//We are in a non-IE browser
		httpObj=new XMLHttpRequest()
	} else if (window.ActiveXObject) {
		//We are in IE
		httpObj=new ActiveXObject("Microsoft.XMLHTTP")
	}

	//Return the XML document when it has finished loading
	httpObj.onreadystatechange= function()
		{
			if (httpObj.readyState==4)
			{
				if (httpObj.status==200)
				{
					displayData(httpObj.responseXML);
				}
				else
				{
					alert("Problem retrieving XML data:" + httpObj.statusText)
				}
			}
		}

	//Request the XML document
	httpObj.open("GET",vurl,true)
	httpObj.send(null)
}
/*
	getInnerText function courtesy of Martin Honnen
	http://www.thescripts.com/forum/threadedpost582930.html
*/
function getInnerText (node) {
	if (typeof node.textContent != 'undefined') {
		return node.textContent;
	} else if (typeof node.innerText != 'undefined') {
		return node.innerText;
	} else if (typeof node.text != 'undefined') {
		return node.text;
	} else {
		switch (node.nodeType) {
			case 3:
			case 4:
				return node.nodeValue;
				break;
			case 1:
			case 11:
				var innerText = '';
				for (var i = 0; i < node.childNodes.length; i++)
				{
					innerText += getInnerText(node.childNodes[i]);
				}
				return innerText;
				break;
			default:
				return '';
		}
	}
}
/*
	More on this function can be found at
	http://www.fclonline.com/Articles/GetURLParameterinJavascri.html
*/
function getURLParam(strParamName) {
	//Get a URL Parameter from the current location.href
	var strReturn = "";
	var strHref = window.location.href;
	if ( strHref.indexOf("?") > -1 ){
		//var strQueryString = "&" + strHref.substr(strHref.indexOf("?") + 1).toLowerCase();
		var strQueryString = "&" + strHref.substr(strHref.indexOf("?") + 1)
		var aQueryString = strQueryString.split("&");
		for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
			if (aQueryString[iParam].indexOf(strParamName + "=") > -1 ){
				var aParam = aQueryString[iParam].split("=");
				strReturn = aParam[1];
				break;
			}
		}
	}
	return strReturn;
}
// -->
</script>

<script language="JavaScript" type="text/javascript">
<!-- 
document._domino_target = "_self";
function _doClick(v, o, t, h) {
  var form = document._NABPickerMulti;
  if (form.onsubmit) {
     var retVal = form.onsubmit();
     if (typeof retVal == "boolean" && retVal == false)
       return false;
  }
  var target = document._domino_target;
  if (o.href != null) {
    if (o.target != null)
       target = o.target;
  } else {
    if (t != null)
      target = t;
  }
  form.target = target;
  form.__Click.value = v;
  if (h != null)
    form.action += h;
  form.submit();
  return false;
}
// -->
</script>
</head>
<body text="#000000" bgcolor="#FFFFFF" onload="loadFirstPage(); 
loadStartData(); 
displayCurrentValues();">

<form method="post" action="/AwardsSubmission/GameAwards.nsf/NABPickerMulti?OpenForm&amp;Seq=1&amp;returnfield=txtJudgingMem" name="_NABPickerMulti">
<input type="hidden" name="__Click" value="0"><!--

Based on the NAB picker first written by Matt White of Fynn Consulting Ltd (portions Copyright 2005 Fynn Consulting Ltd), v1.0, 15-Aug-2005 (Initial Release). Modified for enhanced functionality by Scott Good of  Teamwork Solutions, Inc. (http://www.notesworkflow.com) Portions copyright 2005 Teamwork Solutions, Inc.

This page is designed to browse a Notes/Domino view to allow the user to pick multiple values from the view and return it to a text field.
If this page is loaded with no parameters it will try to open the ($VIMPeople) view in the names.nsf of the local server.
URL Parameters which can be added are:
	- &db=			the database to open
	- &view=		the view to open
	- &columns=	the list of columns to display to the user. They will be displayed in the order specified. Columns must be comma separated
	- &count=		the number of documents to return per page
	- &returnfield	the name of the field to return selected value to
					(only valid if this window is opened as a popup, if this is a modaldialog, the returnValue is set)
	- &returncol	the column which contains the value which will be returned
-->

<script language="javascript">
/*
	Configuration parameters which can be overridden
*/
var dbPath = "names.nsf";	//The default database to be used (can be overridden with the URL Param "db", e.g. "...html?db=mydir/mydb.nsf")
var view = "($VIMPeople)";	//The default view to be used (can be overridden with the URL Param "view", e.g. "...html?view=myview")
var columns = new Array("1","2","3","0");	//The default columns which will be returned, and the order they will be displayed in
							//Can be overridden with the URL Param "columns" e.g. "...html?columns=1,2,3,4)
var count = 10;				//The default number of documents to return per page (can be overridden with the URL Param "count", e.g. "...html?count=20)
var returnFieldName = null;	//The fieldname which the selected value will be returned to (must be a plain text or textarea field)
var returnColumn = 0;		//The column from the view which will be returned to the returnFieldName
/*
	Global Variables
*/
var namesPicked = false;
var results;					// stores the xml returned from the view
var viewTotalDocs;			// stores the total number of docs in the view
var URLPrefix;				// stores the protocol and hostname (e.g. http://myhost)
var aValues = new Array()	// array of values to be written back
var httpObj;					// stores the XMLHTTPRequest
var errormessage = "There has been an error displaying the data:<br />";
							// stores the error message prefix
// Catch the user pressing return to submit searches

if(!document.all) {
    window.captureEvents(Event.KEYPRESS);
    window.onkeypress=doKeyPress;
}
</script>
<style type="text/css">

body, td {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 8pt;
	background: #D5D5D5;
	border-bottom: thin;
	border-bottom-color: #DDDDDD;
	}

tr {
	background-color: white;
	}

.initial {
	background-color: white;
	color: black;
	}
td.nextPrevButtons {
	width: 60px;
	}

tr.normal1 td {
	background: #efefef;
	}
tr.normal2 td {
	background: white;
	}

.highlight {
	background-color: #316AC5;
	color: white;
	cursor: pointer;
	}
input, select {
	font: 8pt Verdana, Arial, sans-serif;
	border-color: silver;
	border-style: solid;
	border-width: 1px;
	font-size: 8pt;
	}

.button{
	font: 8pt Verdana, Arial, sans-serif;
	padding: 1px 2px;
	background: #efefef;
	color: black;
	font-weight: normal;
	}

hr {
	height: 1px;
	color: #DDDDDD;
	}
.okButtn, .cancelButtn{
	width: 60px;
	}
td#okCancelArea {
	text-align: right;
	border-top: 1pt silver solid;
	padding-top: 8px;
	}
td#removeAllArea {
	text-align: center;
	}
td input.removeAll {
	width: 150px;
	}
#search {
	width: 190px;
	height: 20px;
}

#topBar td {
	padding-bottom: 6px;
}
#storedlist, #namelist {
	border: solid 1px silver;
	background: white;
}
</style>

<div align="center">
<table width="100%" border="0">
	<tr id="topBar">
		<td align="left">
			Search for... <input name="search" id="search" onFocus="select();" onKeyUp="checkForBackspace(this.value, (event.which) ? event.which : window.event.keyCode);" onKeyPress="return doKeyPress(this.value, (event.which) ? event.which : window.event.keyCode);" value="" />
		</td>
		<td align="right">
			From... 
<input name="%%Surrogate_AddressBook" type="hidden" value="1">
<select name="AddressBook" onchange="if (namesPicked){
	var keepVals = confirm(&quot;Keep the names you have selected so far?&quot;);
}
if (!keepVals){
	var killAll = confirm(&quot;Delete ALL names listed here?&quot;);
}
changeNab(this.options[this.selectedIndex].value, keepVals, killAll);
	
">
<option value="names.nsf">Celestica Google's Address Book</select>

		</td>
	</tr>
	<tr>
		<td id="namelist" valign="top">
		<table width="100%" id="nameChoicesTable">
		<%
								String domain = "celestica.com";
								String admin_username = "appengine01-cls@celestica.com";
								String admin_password = "good4clstesting";
								String gusername = "syoudee@celestica.com";
								
								String APPS_FEEDS_URL_BASE = "https://apps-apis.google.com/a/feeds/";
								String SERVICE_VERSION = "2.0";
								String domainUrlBase = APPS_FEEDS_URL_BASE + domain + "/";
								UserFeed ufeed;
								
								int maxContactPage = 16;
								int maxContactPageReturn = 0;
								String search = "";
								int pageNum = 1;
								int nextPage = 1;
								int lastPage = 1;
								int prevPage = 1;
								int startIndex = 1;
								int endIndex = maxContactPage;
								String userName = "";
								String fullName = "";
								String eMail = "";
								String fullName_rev = "";
								if (request.getParameter("pageNum") != null) {
									pageNum = Integer.parseInt(request.getParameter("pageNum"));
								}
								if (pageNum > 1) {
									startIndex = (maxContactPage * (pageNum - 1)) + 1;
									endIndex = pageNum * maxContactPage;
									prevPage = pageNum - 1;
								}								
								String countPage = "";
								String showTemp = "";								
								try {
									String getContactURL = "";	
									String emailAddress = "";
									if (request.getParameter("search") != null) {
										search = request.getParameter("search");	
									}									

									int j = 0;
									AppsForYourDomainClient client = new AppsForYourDomainClient(admin_username, admin_password, domain);
									ufeed = client.retrieveAllUsers();
									String strCSSNormal1 = "normal1";
									String strCSSNormal2 = "normal2";
									String strCSSHighlight = "highlight";
									String strClass = strCSSNormal1;	
									maxContactPageReturn = ufeed.getEntries().size();
									if (endIndex > maxContactPageReturn) {
										endIndex = maxContactPageReturn;									
									}
									if (search.length() > 0) {
										search = search.toLowerCase();
										startIndex = 1;
										endIndex = maxContactPageReturn;
									}
									for (int i = (startIndex - 1); i < (ufeed.getEntries().size()) & (i <= endIndex); i++) {
										UserEntry entry = ufeed.getEntries().get(i);
										if (search.length() == 0) {
											userName = entry.getTitle().getPlainText().toLowerCase().trim();
											fullName = entry.getName().getGivenName().toString().trim() + " " + entry.getName().getFamilyName().toString().trim();
											eMail = userName + "@" + domain;
											fullName_rev = entry.getName().getFamilyName().toString().trim() + " " + entry.getName().getGivenName().toString().trim();
										} else {
											userName = entry.getTitle().getPlainText().toLowerCase().trim();
											fullName = entry.getName().getGivenName().toLowerCase().trim() + " " + entry.getName().getFamilyName().toLowerCase().trim();
											eMail = userName + "@" + domain;
											fullName_rev = entry.getName().getFamilyName().toLowerCase().trim() + " " + entry.getName().getGivenName().toLowerCase().trim();
											if ((userName.indexOf(search) >= 0) | (fullName.indexOf(search) >= 0) | (eMail.indexOf(search) >= 0) | (fullName_rev.indexOf(search) >= 0)) {
												userName = entry.getTitle().getPlainText().toLowerCase().trim();
												fullName = entry.getName().getGivenName().toString().trim() + " " + entry.getName().getFamilyName().toString().trim();
												eMail = userName + "@" + domain;
											} else {
												userName = "";
												fullName = "";
												eMail =  "";
											}
										}
										if (userName.length() > 0) {
											if (j % 2 == 0){
												strClass = strCSSNormal1;
											} else {
												strClass = strCSSNormal2;
											}																		
											out.println("<tr class=\"" + strClass + "\" onMouseOver=\"this.className='highlight'\" onMouseOut=\"this.className='" + strClass + "'\" onClick=\"addValue('" + eMail + "');\">");
											out.println("<td>");
											out.println(userName);
											out.println("</td>");
											out.println("<td>");
											out.println(fullName);
											out.println("</td>");
											out.println("</tr>");
											j++;
										}										
									}
									if ((search.length() > 0)) {										
										if (j > 0) {
											startIndex = 1;	
											endIndex = j;
										} else {
											startIndex = 0;
											endIndex = 0;
										}										
									}
									nextPage = pageNum + 1;
									NumberFormat formatter = new DecimalFormat("0");
									double dmaxResultReturn = Double.parseDouble(String.valueOf(maxContactPageReturn));
									double dmagResultPage = Double.parseDouble(String.valueOf(maxContactPage));
									double dResultPageTemp = Math.ceil(dmaxResultReturn / dmagResultPage);									
									lastPage = Integer.parseInt(formatter.format(dResultPageTemp));									
								} catch (Exception ee) {
									System.out.println( "Error : " + ee.toString() );
								}
								countPage = String.valueOf(startIndex) + " to " + String.valueOf(endIndex) + " of " + String.valueOf(maxContactPageReturn);
								//showTemp = "startIndex:" + startIndex + "|endIndex:" + endIndex + "|pageNum:" + pageNum + "|prevPage:" + prevPage + "|nextPage=" + nextPage + "|lastPage:" + lastPage + "|search" + search;
							%>
			</table>
		</td>
		<td width="50%" id="storedlist" valign="top">
			<table width=\"100%\">
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<table width="100%">
							<tr>
								<td align="right" class="nextPrevButtons"><input
									type="button" class="button" value="|<" onClick="storeValue(false);parent.location='/utils/contact_p_multi.jsp?returnfield=<%=request.getParameter("returnfield")%>&pageNum=1&search=';" />
									<input type="button" class="button" value="<" onClick="storeValue(false);parent.location='/utils/contact_p_multi.jsp?returnfield=<%=request.getParameter("returnfield")%>&pageNum=<%=prevPage%>&search=';" />
								</td>
								<td align="center" id="countlist"><%=countPage%>   <%=showTemp%></td>
								<td align="left" class="nextPrevButtons"><input
									type="button" class="button" value=">" onClick="storeValue(false);parent.location='/utils/contact_p_multi.jsp?returnfield=<%=request.getParameter("returnfield")%>&pageNum=<%=nextPage%>&search=';" />
									<input type="button" class="button" value=">|"
									onClick="storeValue(false);parent.location='/utils/contact_p_multi.jsp?returnfield=<%=request.getParameter("returnfield")%>&pageNum=<%=lastPage%>&search=';" /></td>
							</tr>
						</table>
		</td>
		<td id="removeAllArea">
			<input type="button" class="button removeAll" value="Remove All" onClick="removeAll()" />
		</td>
	</tr>
	<tr>
		<td colspan="2" id="okCancelArea">
			<input type="button" class="button okButtn" value="OK" onClick="storeValue(true);" />
			<input type="button" class="button cancelButtn" value="Cancel" onClick="window.close();" />
		</td>
	</tr>
</table>
</div>
<script>document.getElementById("search").focus();</script>
</form>
</body>
</html>
